package com.ssm.subject.infra.basic.service.impl;

import com.alibaba.fastjson.JSON;
import com.ssm.subject.infra.basic.entity.SubjectJudge;
import com.ssm.subject.infra.basic.mapper.SubjectJudgeDao;
import com.ssm.subject.infra.basic.service.SubjectJudgeService;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 判断题(SubjectJudge)表服务实现类
 *
 * @author makejava
 * @since 2024-11-29 10:24:45
 */
@Service("subjectJudgeService")
@Log4j2
public class SubjectJudgeServiceImpl implements SubjectJudgeService {
    @Resource
    private SubjectJudgeDao subjectJudgeDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public SubjectJudge queryById(Long id) {
        return this.subjectJudgeDao.queryById(id);
    }

    /**
     * 新增数据
     *
     * @param subjectJudge 实例对象
     * @return 实例对象
     */
    @Override
    public void insert(SubjectJudge subjectJudge) {
        if(log.isInfoEnabled()) {
            log.info("SubjectJudgeService.add.subjectJudge:{}", JSON.toJSONString(subjectJudge));
        }
        this.subjectJudgeDao.insert(subjectJudge);
    }

    /**
     * 修改数据
     *
     * @param subjectJudge 实例对象
     * @return 实例对象
     */
    @Override
    public int update(SubjectJudge subjectJudge) {
        return this.subjectJudgeDao.update(subjectJudge);
    }

    /**
     * 查询
     * @param subjectJudge
     * @return
     */
    @Override
    public List<SubjectJudge> query(SubjectJudge subjectJudge) {
        return this.subjectJudgeDao.query(subjectJudge);
    }
}
